import { http } from '@/utils/http/axios';
export interface RoleInfo {
	roleName: string;
	value: string;
}
export interface LoginResultModel {
	userId: string | number;
	token: string;
	role: RoleInfo;
}
enum Api {
	Login = '/login',
	Logout = '/logout',
	GetUserInfo = '/getUserInfo',
	GetPermCode = '/getPermCode',
}

export function loginApi(params, mode:any = 'none') {
	return http.post<LoginResultModel>(
		{
			url: Api.Login,
			params,
		},
		{
			errorMessageMode: mode,
		}
	);
}

/**
 * @description: getUserInfo
 */
 export function getUserInfo() {
	return http.get<any>({ url: Api.GetUserInfo }, { errorMessageMode: 'none' });
  }
  
  export function getPermCode() {
	return http.get<string[]>({ url: Api.GetPermCode });
  }
  
  export function doLogout() {
	return http.get({ url: Api.Logout });
  }
  